Page({
  data: {
    mode: '',
    datetimeVisible: false,
    datetime: new Date().getTime(),
    datetimeText: '',
  },
  showPicker(e) {
    const { mode } = e.currentTarget.dataset;
    this.setData({
      mode,
      [`${mode}Visible`]: true,
    });
  },
  hidePicker() {
    const { mode } = this.data;
    this.setData({
      [`${mode}Visible`]: false,
    });
  },
  onConfirm(e) {
    const { value } = e.detail;
    const { mode } = this.data;

    console.log('confim', value);

    let dateTimeLon =parseInt(new Date(value).getTime()/1000);

    this.setData({
      [mode]: dateTimeLon,
      [`${mode}Text`]: value,
    });
    console.log(this.data)
    this.hidePicker();
  },

  onColumnChange(e) {
    console.log('pick', e.detail.value);
  },

  tapChild(e) {
    this.triggerEvent('click',this.data);
  },

});
